package root.electronclass.electronclass.ext

import root.electronclass.electronclass.App

/**
 *
 * @author Lokiy
 * @date 2023/2/4 17:20
 */

val Int.dp: Float
    get() = this.toFloat()

val Float.dp: Float
    get() = this

val Int.sp: Float
    get() = toFloat()

val Float.toDp: Float
    get() = this

val Int.chineseNumber: String
    get() = when (this) {
        1 -> "一"
        2 -> "二"
        3 -> "三"
        4 -> "四"
        5 -> "五"
        6 -> "六"
        7 -> "七"
        8 -> "八"
        9 -> "九"
        10 -> "十"
        in 11..19 -> "十" + (this % 10).chineseNumber
        20, 30, 40, 50, 60, 70, 80, 90 -> (this / 10).chineseNumber + "十"
        in 21..99 -> (this / 10).chineseNumber + "十" + (this % 10).chineseNumber
        else -> {
            ""
        }
    }